package com.springboot.service.impl;

import com.springboot.mapper.OrderFormMapper;
import com.springboot.mapper.PatientInfoFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.OrderForm;
import com.springboot.model.PatientInfoForm;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorViewPatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 医生查看患者详情
 */
@Service
public class DoctorViewPatientServiceImpl implements DoctorViewPatientService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;

    @Autowired
    private OrderFormMapper orderFormMapper;

    @Autowired
    private PatientInfoFormMapper patientInfoFormMapper;

    //通过手机号码查找用户
    @Override
    public UserLoginForm findUserByTel(String tel)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByTel(tel);
        return userLoginForm;
    }

    //通过外键查找预约记录
    @Override
    public OrderForm findOrderById(OrderForm record)
    {
        OrderForm orderForm=orderFormMapper.selectByForeignKey(record);
        return orderForm;
    }

    //通过预约id查找预约就诊病患详情
    @Override
    public PatientInfoForm findDetailsBybook(Integer id)
    {
        PatientInfoForm patientInfoForm=patientInfoFormMapper.selectByPrimaryKey(id);
        return patientInfoForm;
    }
}
